package org.tekmob.remindpal;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Vibrator;
import android.widget.Toast;

public class AlarmReceiver extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent intent) {
		/*if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
		  cal.set(Calendar.YEAR, allReminder.get(i).getYear());
			cal.set(Calendar.MONTH, allReminder.get(i).getMonth());
			cal.set(Calendar.DAY_OF_MONTH, allReminder.get(i).getDate());

			cal.set(Calendar.HOUR_OF_DAY, allReminder.get(i).getHour());
			cal.set(Calendar.MINUTE, allReminder.get(i).getMinute());
		  Calendar cal = Calendar.getInstance();
		  cal.add(Calendar.SECOND,5 );

			//Create a new PendingIntent and add it to the AlarmManager
			Intent intent2 = new Intent(context, AlarmReceiverActivity.class);
			PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
					123, intent2, PendingIntent.FLAG_CANCEL_CURRENT);
			AlarmManager am = 
					(AlarmManager) context.getSystemService(Activity.ALARM_SERVICE);
			am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
					pendingIntent);
	  }*/ 

		Toast.makeText(context, "Time is up!!!!.",
				Toast.LENGTH_LONG).show();
		// Vibrate the mobile phone
		Vibrator vibrator = (Vibrator) context
				.getSystemService(Context.VIBRATOR_SERVICE);
		vibrator.vibrate(2000);


	}

} 